package com.zmn.plat.common.dictionary;

/**
 * 渠道城市系数类型枚举
 *
 * @author linfeng
 * @since 2020/06/15 14:56:30
 */
public enum ChannelCityRatioTypeEnum {

    /**
     * values
     */
    CHANNELRATIO(101, "渠道默认系数"),
    DISCOUNTRATIO(102, "渠道折扣系数"),
    CHANNELCITYRATIO(103, "渠道城市默认系数"),
    CHANNELCITYCATEGONERATIO(104, "渠道城市产品一级分类系数"),
    CHANNELCITYCATEGTWORATIO(105, "渠道城市产品二级分类系数"),
    CHANNELCITYMETER3RATIO(106, "渠道城市计价器3.0系数"),
    ;

    private Integer code;
    private String name;

    ChannelCityRatioTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelCityRatioTypeEnum of(Integer code) {
        if (code == null || code == 0) {
            return CHANNELRATIO;
        }
        switch (code) {
            case 101:
                return CHANNELRATIO;
            case 102:
                return DISCOUNTRATIO;
            case 103:
                return CHANNELCITYRATIO;
            case 104:
                return CHANNELCITYCATEGONERATIO;
            case 105:
                return CHANNELCITYCATEGTWORATIO;
            default:
                return CHANNELRATIO;
        }
    }
}
